package com.durian.base.net;

/**
 * 说明：Part
 * <p/>
 * 作者：fanly
 * <p/>
 * 类型：Class
 * <p/>
 * 时间：2019/1/31 09:48
 * <p/>
 * 版本：version 1.0
 */
public class Part{
    private String      key;
    private String      value;
    private FileWrapper fileWrapper;

    public Part(String key, String value){
        setKey(key);
        setValue(value);
    }

    public Part(String key, FileWrapper fileWrapper){
        setKey(key);
        setFileWrapper(fileWrapper);
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public FileWrapper getFileWrapper() {
        return fileWrapper;
    }

    public void setFileWrapper(FileWrapper fileWrapper) {
        this.fileWrapper = fileWrapper;
    }

    @Override
    public boolean equals(Object o) {
        if (o==null || !(o instanceof Part)){
            return false;
        }
        Part part1 = (Part)o;
        if (part1 == null || part1.getKey() == null || part1.getValue() == null){
            return false;
        }
        if (part1.getKey().equals(getKey()) && part1.getValue().equals(getValue())){
            return true;
        }
        return false;
    }
}
